// 04myCenter/02set/set.js
var co = require('../../resource/js/common.js')
var ws = require('../../resource/js/websocket.js')
var app = getApp()
var _this, _data

Page({
   /**
    * 页面的初始数据
    */
   data: {
      bizShow: false //企业列
   },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function(options) {
      _this = this
      _data = this.data
   },
   //跳转到查看个人设置
   toPersonal: function() {
      wx.navigateTo({
         url: '/04myCenter/02set/02bindPhone/bindPhone',
      })
   },
   //跳转到企业查看企业设置
   toEnterPrise: function(e) {
      var Biz_ID = e.currentTarget.dataset.biz_id
      //console.log('Biz_ID', Biz_ID)
      wx.navigateTo({
         url: '/04myCenter/02set/01enterpriseSet/enterpriseSet?Biz_ID=' + Biz_ID,
      })
   },
   //退出登录
   logOut: function() {
      app.Data.userInfo = ''
      wx.setStorageSync('userInfo', '')
      ws.onSocketMsg(null)
      wx.reLaunch({
         url: '/04myCenter/myCenter',
      })
   },
   //获取企业列表
   getBizList: function() {
      var url = 'jyhs/Admin/getBizList'
      co.getShareApi(url, {
         User_ID: app.Data.userInfo.User_ID
      }, function(res) {
         if (res.code == 0) {
            console.log('res1', res)
            _this.setData({
               bizShow: true
            })
         } else {
            //co.toastAllText(res.msg)
         }
      })
   },
   //绑定手机
   toBindPhone: function() {
      wx.navigateTo({
         url: '/04myCenter/02set/01bindPhone/bindPhone',
      })
   },
   //修改登录密码
   toChangeLoginPwd: function() {
      wx.navigateTo({
         url: '/04myCenter/02set/03changeLoginPwd/changeLoginPwd',
      })
   },
   //修改支付密码
   toChangePayPwd: function() {
      wx.navigateTo({
         url: '/04myCenter/02set/02changePayPwd/changePayPwd',
      })
   },
   //跳转到企业设置
   toEnterpriseSet: function() {
      wx.navigateTo({
         url: '/04myCenter/02set/04enterpriseSet/enterpriseSet',
      })
   },
})